#include <arch/cpu/soc/irq.S>

vector_irq:
	sub lr, lr, #4
	stmia sp, {r0, lr}			@ save r0, lr_irq (parent pc)
	mrs lr, spsr
	str lr, [sp, #8]			@ save spsr_irq (parent cpsr)
	mov r0, sp					@ r0 = sp_irq

	@ switch to SVC mode
	mrs lr, cpsr
	eor lr, lr, #(ARM_MODE_IRQ ^ ARM_MODE_SVC)
	msr cpsr_c, lr	

	str lr, [sp, #-8]!			@ save lr_svc
	ldr lr, [r0, #4]			
	str lr, [sp, #4]			@ save lr_irq
	ldr lr, [r0, #8]			@ get spsr
	ldr r0, [r0]				@ get r0
	stmdb sp!, {r0 - r2, lr}
	
	get_irqnr_preamble r2, lr
	get_irqnr_and_base r0, r1, r2, lr

    bne do_irq 

